package com.hundsun.cprs.yyt.service.goods.dto;

import java.util.List;

public class AttributeInfo {
    private List<AttributeForm> attributeFormList;
    private Integer stockNum;//库存
    private Double itemPrice;//售价
    private Integer quotaAmount;//配额
    private Long skuId;//规格id，修改商品属性规格时使用
    private Integer allocatedStock=0;//预占库存
    private Integer availableStock;//当前可售库存

    public List<AttributeForm> getAttributeFormList() {
        return attributeFormList;
    }

    public void setAttributeFormList(List<AttributeForm> attributeFormList) {
        this.attributeFormList = attributeFormList;
    }

    public Integer getStockNum() {
        return stockNum;
    }

    public void setStockNum(Integer stockNum) {
        this.stockNum = stockNum;
    }

    public Double getItemPrice() {
        return itemPrice;
    }

    public void setItemPrice(Double itemPrice) {
        this.itemPrice = itemPrice;
    }

    public Integer getQuotaAmount() {
        return quotaAmount;
    }

    public void setQuotaAmount(Integer quotaAmount) {
        this.quotaAmount = quotaAmount;
    }

    public Long getSkuId() {
        return skuId;
    }

    public void setSkuId(Long skuId) {
        this.skuId = skuId;
    }

    public Integer getAllocatedStock() {
        return allocatedStock;
    }

    public void setAllocatedStock(Integer allocatedStock) {
        this.allocatedStock = allocatedStock;
    }

    public Integer getAvailableStock() {
        int goodsStock = getStockNum() == null?0:getStockNum();
        int allocatiedStock = getAllocatedStock() == null?0:getAllocatedStock();
        int availableStock = goodsStock - allocatiedStock;
        return availableStock < 0?0:availableStock;
    }

    public void setAvailableStock(Integer availableStock) {
        this.availableStock = availableStock;
    }
}
